#include <iostream>
#include <string>
#include <functional>
#include "MessageRoute.hpp"
#include "UdpServer.hpp"
#include "Log.hpp"

void Usage(char *arg)
{
    std::cout << "Usage:  please enter:" << std::endl;
    std::cout << arg << ' ' << "server port" << std::endl;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    EnableScreen();
    uint16_t port = std::stoi(argv[1]);

    // 定义路由模块
    MessageRoute route;

    // 定义网络模块
    UdpServer server(port, std::bind(&MessageRoute::Route, &route,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3));
    server.InitServer();
    server.StartServer();

    return 0;
}